//实现forEach
function forEach(list, callback) {
    for(var n = 0; n < list.length; n++){
        callback.call(list[n], n);
    }
}

var weapons = [
    {type: 'shuriken'},
    {type: 'katana'},
    {type: 'nunchuncks'}
];

forEach(weapons, function (index) {
    console.log(this)
});